{% extends "base.html" %}

{% block title %}价格统计 - 惠农平台{% endblock %}

{% block content %}
<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-header">
                <h3><i class="fas fa-chart-bar me-2"></i>不同类型农产品价格统计</h3>
            </div>
            <div class="card-body">
                <!-- 筛选条件 -->
                <div class="row mb-4">
                    <div class="col-md-4">
                        <label for="statTypeSelect" class="form-label">统计类型</label>
                        <select class="form-select" id="statTypeSelect">
                            <option value="avg" selected>平均价格</option>
                            <option value="min">最低价格</option>
                            <option value="max">最高价格</option>
                            <option value="median">中位数价格</option>
                        </select>
                    </div>
                    <div class="col-md-4 d-flex align-items-end">
                        <button type="button" class="btn btn-primary" onclick="initPriceStatistics()">
                            <i class="fas fa-refresh me-1"></i>刷新图表
                        </button>
                    </div>
                </div>

                <!-- 图表容器 -->
                <div class="chart-container">
                    <div id="priceStatisticsChart" style="width: 100%; height: 500px;"></div>
                </div>

                <!-- 统计信息卡片 -->
                <div class="row mt-4">
                    <div class="col-md-3">
                        <div class="card text-center">
                            <div class="card-body">
                                <h5 class="card-title text-success">蔬菜类</h5>
                                <h3 class="text-primary">¥3.5</h3>
                                <p class="text-muted">平均价格</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="card text-center">
                            <div class="card-body">
                                <h5 class="card-title text-success">水果类</h5>
                                <h3 class="text-primary">¥5.2</h3>
                                <p class="text-muted">平均价格</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="card text-center">
                            <div class="card-body">
                                <h5 class="card-title text-success">粮食类</h5>
                                <h3 class="text-primary">¥2.8</h3>
                                <p class="text-muted">平均价格</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="card text-center">
                            <div class="card-body">
                                <h5 class="card-title text-success">油料类</h5>
                                <h3 class="text-primary">¥4.1</h3>
                                <p class="text-muted">平均价格</p>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 说明信息 -->
                <div class="mt-4">
                    <div class="alert alert-info">
                        <h5><i class="fas fa-info-circle me-2"></i>图表说明</h5>
                        <ul class="mb-0">
                            <li>本图表展示了不同类型农产品的价格统计对比</li>
                            <li>可以选择不同的统计类型（平均价格、最低价格、最高价格、中位数价格）</li>
                            <li>柱状图直观显示了各类农产品的价格差异</li>
                            <li>下方卡片展示了各类农产品的具体价格数据</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 